﻿using System;
using System.Collections;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Text;
using System.Data.SqlClient;

namespace YXShop.Web.filehandle
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class active_option : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            if (HttpContext.Current.Request.QueryString["channelId"] != "")
            {
                string strs = Channel_Class_Menu(HttpContext.Current.Request.QueryString["channelId"]);
                context.Response.Write(strs);
            }
        }

        #region   频道的文章类别
        public string Channel_Class_Menu(string channelId)
        {   
            YXShop.BLL.SystemInfo.ArticleChannel bll=new YXShop.BLL.SystemInfo.ArticleChannel();
            StringBuilder tempStr = new StringBuilder();
            tempStr.Append("→顶级类别|0");
            SqlDataReader dr =bll.GetAll(channelId);
            while (dr.Read())
            {
                string tempText = "";
                string spaceStr = "";
                for (int i = 1; i < Convert.ToInt32(dr["Class_Depth"]); i++)
                {
                    spaceStr += "";
                }
                tempText = spaceStr + "┝" + dr[1].ToString();
                tempStr.Append("," + tempText + "|" + dr[0].ToString());
            }
            dr.Close();
            return tempStr.ToString();
        }
        #endregion

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
